package com.bw.day_2.adapter

import android.graphics.Color
import android.media.tv.TvView
import android.widget.TextView
import com.bw.base.entity.ParkEntityItem
import com.bw.base.mvvm.BaseViewModel
import com.bw.day_2.R
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

class ParkAdapter:BaseQuickAdapter<ParkEntityItem,BaseViewHolder>(R.layout.park_item) {
    override fun convert(helper: BaseViewHolder, item: ParkEntityItem) {
        helper.setText(R.id.cwgl_tv1,item.spaceNumber)
        helper.setText(R.id.cwgl_tv2,item.areaName)
        helper.setText(R.id.cwgl_tv3,item.spaceType)
        helper.setText(R.id.cwgl_tv4,item.userName)
        helper.setText(R.id.cwgl_tv5,item.licensePlate)
        helper.setText(R.id.cwgl_tv6,item.spaceStatus)
        if (item.spaceStatus == "空闲"){
            helper.getView<TextView>(R.id.cwgl_tv6).setTextColor(Color.BLUE)
            helper.getView<TextView>(R.id.cwgl_tv6).setBackgroundColor(Color.RED)
        } else if(item.spaceStatus == "空闲"){
            helper.getView<TextView>(R.id.cwgl_tv6).setTextColor(Color.YELLOW)
            helper.getView<TextView>(R.id.cwgl_tv6).setBackgroundColor(Color.GREEN)
        } else{
            helper.getView<TextView>(R.id.cwgl_tv6).setTextColor(Color.GREEN)
            helper.getView<TextView>(R.id.cwgl_tv6).setBackgroundColor(Color.YELLOW)
        }

    }
}